package com.kun.service;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) 不加会报错
 * 报错说这个类不是安全的
 * @author kun.li
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
public class KunUser extends User {

    private String userId;

    private String tenantId;

    private Integer hasAdmin;

    public KunUser(String username, String password, String userId, String tenantId,Integer hasAdmin,Collection<? extends GrantedAuthority> authorities) {
        super(username, password, authorities);
        this.userId = userId;
        this.tenantId=tenantId;
        this.hasAdmin=hasAdmin;
    }

    public String getUserId() {
        return userId;
    }

    public String getTenantId() {
        return tenantId;
    }

    public Integer getHasAdmin() {
        return hasAdmin;
    }
}
